#pragma once
#pragma warning(disable:4996)       // disable checked iterator errors http://msdn.microsoft.com/en-us/library/aa985965(VS.80).aspx 

//
// Copyright (C) 2011 Steve Channell steve.channell@cepheis.com
//
// This file is part of Cephei.QL, an open-source library wrapper 
// arround QuantLib http://quantlib.org/
//
// Cephei.QL is open source software: you can redistribute it and/or modify it
// under the terms of the license.  You should have received a
// copy of the license along with this program; if not, please email
// <support@cepheis.com>. The license is also available online at
// <http://cepheis.com/license.htm>.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE.  See the license for more details.
//
// Version 2.101

#include <Macros.h>
#include <CoVector.h>
#include <CoMatrix.h>
#include <CoCube.h>
#include <ValueHelpers.h>
#include <Settings.h>

#include <gen/QL/Termstructures/InflationTermStructure.h>
#pragma unmanaged 
#include <ql\experimental\inflation\yoycapfloortermpricesurface.hpp>
#include <boost/smart_ptr/detail/spinlock.hpp>
#pragma managed 

using namespace System;
using namespace QuantLib;
using namespace Cephei;

using namespace Cephei::QL::Times;
using namespace Cephei::QL::Indexes;
using namespace Cephei::QL::Termstructures;
using namespace Cephei::QL::Math;
using namespace Cephei::QL::Termstructures::Inflation;
#define HANDLE
#define ABSTRACT
#undef STRUCT
namespace Cephei { namespace QL { namespace Experimental { namespace Inflation {
	//////////////////////////////////////////////////////////////////////////////////////////////
	// implementation of IYoYCapFloorTermPriceSurface
	public ref class CYoYCapFloorTermPriceSurface : 
            public CInflationTermStructure,
            public Cephei::QL::Experimental::Inflation::IYoYCapFloorTermPriceSurface
	{
	protected: 
		boost::shared_ptr<QuantLib::YoYCapFloorTermPriceSurface>* _ppYoYCapFloorTermPriceSurface;
#ifdef HANDLE
		QuantLib::Handle<QuantLib::YoYCapFloorTermPriceSurface>* _phYoYCapFloorTermPriceSurface;
#endif
		Object^ _YoYCapFloorTermPriceSurfaceOwner;     // reference to object that manages the storage for this object
	internal:
        CYoYCapFloorTermPriceSurface (boost::shared_ptr<QuantLib::YoYCapFloorTermPriceSurface>& childNative, Object^ owner);
        CYoYCapFloorTermPriceSurface (QuantLib::YoYCapFloorTermPriceSurface& childNative, Object^ owner);
        CYoYCapFloorTermPriceSurface (CYoYCapFloorTermPriceSurface^ copy);
        CYoYCapFloorTermPriceSurface (System::Type^ t);
#ifdef STRUCT
        CYoYCapFloorTermPriceSurface (QuantLib::YoYCapFloorTermPriceSurface childNative);
#endif       
#ifdef HANDLE
		CYoYCapFloorTermPriceSurface (QuantLib::Handle<QuantLib::YoYCapFloorTermPriceSurface>& childNative, Object^ owner);
		CYoYCapFloorTermPriceSurface (QuantLib::Handle<QuantLib::YoYCapFloorTermPriceSurface> childNative);
#endif
		virtual ~CYoYCapFloorTermPriceSurface ();
		!CYoYCapFloorTermPriceSurface ();

	internal:
		QuantLib::YoYCapFloorTermPriceSurface& GetReference ();
		boost::shared_ptr<QuantLib::YoYCapFloorTermPriceSurface>& GetShared ();
		QuantLib::YoYCapFloorTermPriceSurface* GetPointer ();
        void SetYoYCapFloorTermPriceSurface (boost::shared_ptr<QuantLib::YoYCapFloorTermPriceSurface> native)
        {
            if (_ppYoYCapFloorTermPriceSurface != NULL)
                delete _ppYoYCapFloorTermPriceSurface;
            _ppYoYCapFloorTermPriceSurface = new boost::shared_ptr<QuantLib::YoYCapFloorTermPriceSurface> (native);
            SetInflationTermStructure (boost::dynamic_pointer_cast<QuantLib::InflationTermStructure> (*_ppYoYCapFloorTermPriceSurface));
        }
#ifdef HANDLE
		QuantLib::Handle<QuantLib::YoYCapFloorTermPriceSurface>& GetHandle ();
#endif
		virtual bool HasNative () override;
    public:
		virtual Double AtmYoYRate (Cephei::QL::Times::IPeriod^ d, Microsoft::FSharp::Core::FSharpOption<Cephei::QL::Times::IPeriod^>^ obsLag, Microsoft::FSharp::Core::FSharpOption<Boolean>^ extrapolate) ;
		virtual Double AtmYoYRate (DateTime d, Microsoft::FSharp::Core::FSharpOption<Cephei::QL::Times::IPeriod^>^ obsLag, Microsoft::FSharp::Core::FSharpOption<Boolean>^ extrapolate) ;
		virtual Double AtmYoYSwapRate (Cephei::QL::Times::IPeriod^ d, Microsoft::FSharp::Core::FSharpOption<Boolean>^ extrapolate) ;
		virtual Double AtmYoYSwapRate (DateTime d, Microsoft::FSharp::Core::FSharpOption<Boolean>^ extrapolate) ;
        property QL::Times::BusinessDayConventionEnum BusinessDayConvention 
        {
		    virtual QL::Times::BusinessDayConventionEnum get () ;
        }
		virtual Double CapPrice (Cephei::QL::Times::IPeriod^ d, Double k) ;
		virtual Double CapPrice (DateTime d, Double k) ;
        property Cephei::IVector<Double>^ CapStrikes 
        {
		    virtual Cephei::IVector<Double>^ get () ;
        }
        property UInt32 FixingDays 
        {
		    virtual UInt32 get () ;
        }
		virtual Double FloorPrice (Cephei::QL::Times::IPeriod^ d, Double k) ;
		virtual Double FloorPrice (DateTime d, Double k) ;
        property Cephei::IVector<Double>^ FloorStrikes 
        {
		    virtual Cephei::IVector<Double>^ get () ;
        }
        property Cephei::IVector<Cephei::QL::Times::IPeriod^>^ Maturities 
        {
		    virtual Cephei::IVector<Cephei::QL::Times::IPeriod^>^ get () ;
        }
        property DateTime MaxMaturity 
        {
		    virtual DateTime get () ;
        }
        property Double MaxStrike 
        {
		    virtual Double get () ;
        }
        property DateTime MinMaturity 
        {
		    virtual DateTime get () ;
        }
        property Double MinStrike 
        {
		    virtual Double get () ;
        }
		virtual Double Price (Cephei::QL::Times::IPeriod^ d, Double k) ;
		virtual Double Price (DateTime d, Double k) ;
        property Cephei::IVector<Double>^ Strikes 
        {
		    virtual Cephei::IVector<Double>^ get () ;
        }
        property Cephei::QL::Indexes::IYoYInflationIndex^ YoyIndex 
        {
		    virtual Cephei::QL::Indexes::IYoYInflationIndex^ get () ;
        }
		virtual DateTime YoyOptionDateFromTenor (Cephei::QL::Times::IPeriod^ p) ;
        property Cephei::QL::Termstructures::IYoYInflationTermStructure^ YoYTS 
        {
		    virtual Cephei::QL::Termstructures::IYoYInflationTermStructure^ get () ;
        }
    };
	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Factory class
	public ref class CYoYCapFloorTermPriceSurface_Factory : public System::MarshalByRefObject,  public IYoYCapFloorTermPriceSurface_Factory
	{
	public:
    };
   
/*Cephei*/ } /*QL*/ } /*Experimental*/ } /*Inflation */}
